package edu.cmu.aes.project2.ws.billing;

public class BillingServiceProxy implements edu.cmu.aes.project2.ws.billing.BillingService {
  private String _endpoint = null;
  private edu.cmu.aes.project2.ws.billing.BillingService billingService = null;
  
  public BillingServiceProxy() {
    _initBillingServiceProxy();
  }
  
  public BillingServiceProxy(String endpoint) {
    _endpoint = endpoint;
    _initBillingServiceProxy();
  }
  
  private void _initBillingServiceProxy() {
    try {
      billingService = (new edu.cmu.aes.project2.ws.billing.BillingServiceServiceLocator()).getBillingServicePort();
      if (billingService != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)billingService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)billingService)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (billingService != null)
      ((javax.xml.rpc.Stub)billingService)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public edu.cmu.aes.project2.ws.billing.BillingService getBillingService() {
    if (billingService == null)
      _initBillingServiceProxy();
    return billingService;
  }
  
  public edu.cmu.aes.project2.ws.billing.Invoice[] getInvoice(java.lang.String arg0) throws java.rmi.RemoteException{
    if (billingService == null)
      _initBillingServiceProxy();
    return billingService.getInvoice(arg0);
  }
  
  public boolean payBill(edu.cmu.aes.project2.ws.billing.Order arg0) throws java.rmi.RemoteException{
    if (billingService == null)
      _initBillingServiceProxy();
    return billingService.payBill(arg0);
  }
  
  public boolean payBillRollBack(edu.cmu.aes.project2.ws.billing.Order arg0) throws java.rmi.RemoteException{
    if (billingService == null)
      _initBillingServiceProxy();
    return billingService.payBillRollBack(arg0);
  }
  
  
}